package com.zeyuan.rpcclient.netty.helloworld01;

import java.io.IOException;
import java.net.InetSocketAddress;
import java.nio.ByteBuffer;
import java.nio.channels.SocketChannel;

public class WriteBigDataClient {
    public static void main(String[] args) throws IOException {
        SocketChannel socketChannel = SocketChannel.open();
        socketChannel.connect(new InetSocketAddress("localhost",8080)); //server发生accpet事件
        int read=0;
        while (true){
            ByteBuffer buffer = ByteBuffer.allocate(1024 * 1024);
            read+= socketChannel.read(buffer); //实际读到的字节数
            System.out.println(read);
            buffer.clear();
        }

    }
}
